<!DOCTYPE html>
<html>
    
    <head>
        <meta charset="utf-8">
        <title>
            X-admin v1.0
        </title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="__STATIC__/admin/css/x-admin.css" media="all">
    </head>

    <body>
        <div class="x-body">
            <form class="layui-form" method="post">
                <div class="layui-form-item">
                    <input type="text" value="{$data.id}" name="id" hidden>
                    <label  class="layui-form-label">
                        <span class="x-red">*</span>彩票
                    </label>
                    <div class="layui-input-inline">
                        <input type="text"  name="name" disabled required="" lay-verify="required"
                        autocomplete="off" class="layui-input" value="{$data.code_name}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label  class="layui-form-label">
                        <span class="x-red">*</span>采集频率(秒)
                    </label>
                    <div class="layui-input-inline">
                        <input type="text"  name="time" required="" lay-verify="ypass"
                        autocomplete="off" class="layui-input" value="{$data.code_time}">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        <span class="x-red"></span>间隔越短服务器压力越大,建议10秒
                    </div>
                </div>
                <div class="layui-form-item">
                    <label  class="layui-form-label">
                        <span class="x-red">*</span>是否开启
                    </label>
                    <div class="layui-input-inline">
                        <input type="text"  name="open" required="" lay-verify="xpass"
                        autocomplete="off" class="layui-input" value="{$data.code_open}">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        <span class="x-red"></span>1为开启2为关闭
                    </div>
                </div>
                <div class="layui-form-item">
                    <label  class="layui-form-label">
                    </label>
                    <button  class="layui-btn" lay-filter="save" lay-submit="">
                        保存
                    </button>
                </div>
            </form>
        </div>
        <script src="__STATIC__/admin/lib/layui/layui.js" charset="utf-8">
        </script>
        <script src="__STATIC__/admin/js/x-layui.js" charset="utf-8">
        </script>
        <script>
            layui.use(['form','layer'], function(){
                $ = layui.jquery;
              var form = layui.form()
              ,layer = layui.layer;



            form.on('submit(save)', function(info){
                var name = $('#username').val();
                var ypass = $('#L_pass').val();
                var xpass = $('#L_repass').val();
                $.ajax({
                    url:"{:url('config/codeEdit')}",
                    data:info.field,
                    type:'post',
                    dataType:'json',
                    success:function (data) {
                        data = JSON.parse(data);
                        if(data.msg == 1){
                            layer.alert(data.data, {icon: 6},function () {
                                // 获得frame索引
                                var index = parent.layer.getFrameIndex(window.name);
                                //关闭当前frame
                                parent.layer.close(index);
                            });
                        }else{
                            layer.alert(data.data,{icon: 5});
                        }
                    },
                    error:function () {
                        layer.alert("服务器出现错误",{icon: 5});
                    }
                })
                return false;
            });


            });
        </script>
        <script>
        var _hmt = _hmt || [];
        (function() {
          var hm = document.createElement("script");
          hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
          var s = document.getElementsByTagName("script")[0]; 
          s.parentNode.insertBefore(hm, s);
        })();
        </script>
    </body>

</html>